import scrapy
from scrapy import Selector

from sipderWorkScrapy.items import CityList


class GetCityList(scrapy.Spider):
    name = 'getCityList'
    allowed_domains = ['www.zhaopin.com']

    start_urls = ['https://www.zhaopin.com/']

    def parse(self, response, **kwargs):
        citys_list = Selector(text=response.text).xpath(
            "//div[@class='footerFuncCity clearfix']/ul/li/strong/a/text()").extract()
        for city in citys_list:
            city_list = CityList()
            city_list['cityName'] = city
            yield city_list
